import xlrd

csvfile = open('hippie-linhas.csv', 'w')
wb = xlrd.open_workbook("hippie.xls")
for sheetname in wb.sheet_names() :
    sh = wb.sheet_by_name(sheetname)
    for rownum in range(sh.nrows - 4) :
        values = []        
        for col in range(sh.ncols):
            if isinstance(sh.cell(rownum + 4,col).value, float):
                csvfile.write(str(sh.cell(rownum,col).value))
            else:
                csvfile.write((sh.cell(rownum + 4,col).value).encode('latin-1'))
            csvfile.write(' | ')
        csvfile.write('\n')
csvfile.close()

'''
import xlrd

csvfile = open('hippie.csv', 'w')

wb = xlrd.open_workbook("hippie.xls")

for sheetname in wb.sheet_names() :
    sh = wb.sheet_by_name(sheetname)
    for rownum in range(sh.nrows) :
        print sh.row_values(rownum)
        values = []        
        for col in range(sh.ncols):
            if isinstance(sh.cell(rownum,col).value, float):
                csvfile.write(str(sh.cell(rownum,col).value))
            else:
                csvfile.write((sh.cell(rownum,col).value).encode('latin-1'))
    csvfile.write('\n')
csvfile.close()
'''